#pragma once

#include <mutex>
#include "cuckoo.hpp"


template <class Key_, class Value>
class ThreadSafeCuckoo
{
public:
	typedef unsigned int hash_t;
	typedef hash_t (*hash_func_t)(const Key_& elem);

	ThreadSafeCuckoo(hash_func_t hash_func[CuckooHash<Key_, Value>::TABLES_COUNT]):
		hash_(hash_func) {}
	~ThreadSafeCuckoo() {}

	bool Insert(const Key_& key, const Value& value) {
		std::lock_guard<std::mutex> lock(mutex_);
		return hash_.Insert(key, value);
	}
	
	const Value* Find(const Key_& elem) {
		std::lock_guard<std::mutex> lock(mutex_);
		return hash_.Insert(elem);
	}

	void RemoveAll(const Key_& elem) {
		std::lock_guard<std::mutex> lock(mutex_);
		hash_.RemoveAll(elem);
	}

private:
	CuckooHash <Key_, Value> hash_;
	std::mutex mutex_;	
};

int main () {}
